<?php
$arrilist = [
    'code' => 0,
    'message' => ''
];
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    echo json_encode(['success' => false, 'message' => 'error: requests are not allowed']);
    exit;
}
require($_SERVER['DOCUMENT_ROOT'].'/cofd/common.php');
$reportid = $_POST['reportid'];
$sql = "DELETE FROM report WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $reportid);
if ($stmt->execute()) {
    $arrilist['message'] = 'Report deleted successfully';
} else {
    $arrilist['message'] = 'Error deleting report';
}
$stmt->close();
$conn->close();
echo json_encode($arrilist, JSON_UNESCAPED_SLASHES);